<template>
  <bpm-c-toptitle :title="bpmcoreI18n.currentStatus"
                  :isCollapse="false">
    <bpm-c-form>
    <bpm-c-block  :preadonly="true"
                  :ptitle="bpmcoreI18n.taskName"
                  pinputtype="text"
                  :pcontent="showCurrStatus.activityName"/>
    <bpm-c-block  :preadonly="true"
                  :ptitle="bpmcoreI18n.user"
                  pinputtype="text"
                  :pcontent="showCurrStatus.currUsers"/>
    </bpm-c-form>
    <bpm-c-form>
    <bpm-c-block  :preadonly="true"
                  :ptitle="bpmcoreI18n.taskType"
                  pinputtype="text"
                  :pcontent="showCurrStatus.approvalType"/>
    <bpm-c-block  :preadonly="true"
                  ptitle=""
                  pinputtype="text"
                  pcontent=""/>
    </bpm-c-form>
  </bpm-c-toptitle>
</template>

<script>
import {mapState} from 'vuex'

export default {
  name: 'bpmDHisheadArea',
  data () {
    return {}
  },
  methods: {
  },
  computed: {
    ...mapState(['currStatus', 'bpmcoreI18n', 'lang']),
    showCurrStatus: function () {
      let currStatusInfo = {}
      currStatusInfo.activityName = ''
      currStatusInfo.approvalType = ''
      currStatusInfo.currUsers = ''
      if (this.currStatus && this.currStatus.length > 0) {
        if (this.lang === 'zh') {
          currStatusInfo.activityName = this.currStatus[0].activityName.substr(0, this.currStatus[0].activityName.indexOf('@'))
        } else {
          currStatusInfo.activityName = this.currStatus[0].activityName.substr(this.currStatus[0].activityName.indexOf('@') + 1)
        }
        if (this.currStatus[0].approvalType === '0') {
          currStatusInfo.approvalType = this.bpmcoreI18n.msgApprovalType0
        } else if (this.currStatus[0].approvalType === '1') {
          currStatusInfo.approvalType = this.bpmcoreI18n.msgApprovalType1
        } else if (this.currStatus[0].approvalType === '2') {
          currStatusInfo.approvalType = this.bpmcoreI18n.msgApprovalType2
        } else if (this.currStatus[0].approvalType === '3') {
          currStatusInfo.approvalType = this.bpmcoreI18n.msgApprovalType3
        } else if (this.currStatus[0].approvalType === '4') {
          currStatusInfo.approvalType = this.bpmcoreI18n.msgApprovalType4
        }
        currStatusInfo.currUsers = this.currStatus[0].currUsers
      }
      console.log('currStatusInfo', currStatusInfo)
      return currStatusInfo
    }
  }
}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
